package com.java.permission.common.utils;

import org.apache.commons.codec.digest.DigestUtils;

/**
 * 密码工具类
 */
public class PasswordUtils {

    public static final String DEFAULT_PASSWORD = "h888888";

    /**
     * 获取MD5加密后的密码
     * @param password
     * @param salt 当前用户id
     * @return
     */
    public static String getMD5Password(String password, String salt) {
        return DigestUtils.md5Hex(password + salt.replaceAll("a", "c") + salt.replaceAll("\\d", "d"));
    }

    public static void main(String[] args) {
        System.out.println(PasswordUtils.getMD5Password(DEFAULT_PASSWORD, "36885c27-8838-11ea-8676-0242ac110003"));

    }

}
